﻿using System.Linq.Expressions;

namespace Jst.IRepository.Repositories
{
    /// <summary>
    /// 仓储接口（已移除 IAggregateRoot 约束）
    /// </summary>
    public interface IRepository<T> where T : class
    {
        Task<T?> GetAsync(object id, CancellationToken ct = default);
        Task InsertAsync(T entity, CancellationToken ct = default);
        Task UpdateAsync(T entity, CancellationToken ct = default);
        Task DeleteAsync(T entity, CancellationToken ct = default);
        Task<bool> ExistsAsync(Expression<Func<T, bool>> predicate, CancellationToken ct = default);
        Task<int> CountAsync(Expression<Func<T, bool>>? predicate = null, CancellationToken ct = default);
    }
}